#################################################
#    	   MAKEFILE FOR VSTUP SERVER		#
#						#
# Autor: Marek Szanyi				#
# Date:  17.1.2010				#
#						#
#################################################


# final product of this makefile
all: vstup

# compilator
CCC = g++

# compilator options
CFLAGS  = -O 

# include headers
INCLUDES = -I. -I../Logger/src -I../PComunicator/src/ -I../Zipios/src/zipios++/ -I../boost/boost/


# linked libs
LIBS = -L../Logger/lib/ -lLogger -L../PComunicator/lib/ -lPComunicator -L../Zipios/lib/ -lZipios \
       -L../boost/lib/ -lboost_filesystem -lboost_date_time -lboost_system -lboost_thread -lpthread -lz

# the server itself
vstup: Client.o CLTConnection.o Server.o SRVConnection.o tinystr.o tinyxml.o tinyxmlerror.o \
       tinyxmlparser.o MetaDirectory.o MetaFile.o Scheme.o Validator.o Zipper.o Options.o \
       Worker.o Alive.o main.o
	$(CCC) $(LIBS) -o vstup main.o Worker.o Alive.o Options.o Server.o SRVConnection.o tinystr.o \
			   tinyxml.o tinyxmlerror.o tinyxmlparser.o MetaDirectory.o MetaFile.o Client.o CLTConnection.o  \
 			   Scheme.o Validator.o Zipper.o $(LIBS)

# server parts
main.o:   ./src/main.cpp 
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/main.cpp

Options.o: ./src/Options.cpp ./src/Options.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Options.cpp 

Worker.o: ./src/Worker.cpp ./src/Worker.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Worker.cpp
	
Alive.o: ./src/Alive.cpp ./src/Alive.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Alive.cpp

Zipper.o: ./src/Zipper/Zipper.cpp ./src/Zipper/Zipper.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Zipper/Zipper.cpp

Validator.o: ./src/Validator/Validator.cpp ./src/Validator/Validator.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Validator/Validator.cpp

Scheme.o: ./src/Validator/Scheme.cpp ./src/Validator/Scheme.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Validator/Scheme.cpp

MetaFile.o: ./src/Validator/MetaFile.cpp ./src/Validator/MetaFile.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Validator/MetaFile.cpp

MetaDirectory.o: ./src/Validator/MetaDirectory.cpp ./src/Validator/MetaDirectory.h 
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Validator/MetaDirectory.cpp

tinyxml.o: ./src/Tinyxml/tinyxml.cpp ./src/Tinyxml/tinyxml.h 
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Tinyxml/tinyxml.cpp 

tinystr.o: ./src/Tinyxml/tinystr.cpp ./src/Tinyxml/tinystr.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Tinyxml/tinystr.cpp

tinyxmlerror.o: ./src/Tinyxml/tinyxmlerror.cpp 
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Tinyxml/tinyxmlerror.cpp

tinyxmlparser.o: ./src/Tinyxml/tinyxmlparser.cpp  
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Tinyxml/tinyxmlparser.cpp

Server.o:  ./src/Server/Server.cpp ./src/Server/Server.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Server/Server.cpp

SRVConnection.o: ./src/Server/SRVConnection.cpp ./src/Server/SRVConnection.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Server/SRVConnection.cpp

Client.o: ./src/Client/Client.cpp ./src/Client/Client.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Client/Client.cpp

CLTConnection.o: ./src/Client/CLTConnection.cpp ./src/Client/CLTConnection.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Client/CLTConnection.cpp

install: vstup
	mkdir -p ./bin/uploads/
	cp ./src/config.ini ./bin/config.ini
	cp vstup ./bin/vstup
	rm *.o

	echo "******** INSTALATION AND STUFF DONE *************\n\n"
